#pragma once

#include "WPModel.h"

class CWordUnit : public WindowImplBase
{
public:
    CWordUnit(void);
    CWordUnit(CWPModel* pWPModel, std::vector<TUnitWord>* pVWords=NULL);

    ~CWordUnit(void);

    LPCTSTR GetWindowClassName() const;	
    virtual void OnFinalMessage(HWND hWnd);
    virtual void Notify(TNotifyUI& msg);
    virtual void InitWindow();
    virtual void OnClick(TNotifyUI& msg);
    virtual LRESULT ResponseDefaultKeyEvent(WPARAM wParam);
    virtual UILIB_RESOURCETYPE GetResourceType() const;
    virtual CDuiString GetSkinFile();
    virtual CDuiString GetSkinFolder();
    virtual CControlUI* CreateControl(LPCTSTR pstrClass);
    virtual LRESULT HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam);
    virtual LRESULT OnSysCommand(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
    virtual LRESULT HandleCustomMessage(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);

protected:
    void OnSelectAll();
    void OnUnSelectAll();

    void ShowWordsOnePage(int nPage, int nCount = 20);

    void OnSelectLeftGroup(bool bCheck);
    void OnSelectRightGroup(bool bCheck);

    void OnClickRandomBtn();

    void OnClickNextPage();

    void OnClickPrevPage();


public:
    CButtonUI* m_pCloseBtn;
    CButtonUI* m_pHelpBtn;
    CButtonUI* m_pMinBtn;
    CWPModel* m_pWPModel;

    std::vector<TUnitWord>* m_vectSelectedWords;

    int m_nCurrentPageNo;
    int m_nTotalPages;

    int m_nType;
};
